import G6 from '@antv/g6'
import {handlerLegendData} from '../methods.js'

// 初始化节点类型
function initLegendExample(nodeData) {
    const {legendType, legendFilterCondition} = handlerLegendData(nodeData)
    return new G6.Legend({
        data: legendType,
        align: 'center',
        layout: 'horizontal',
        position: 'right-top',
        vertiSep: 0,
        horiSep: 18,
        padding: [20, 15, -8, 15],
        containerStyle: {
            fill: 'rgba(255,255,255,0.5)',
            stroke: '#4579f1',
            lineWidth: 1
        },
        filter: {
            enable: true,
            trigger: 'click',
            graphActiveState: 'active',
            graphInactiveState: 'inactive',
            filterFunctions: legendFilterCondition
        }
    })
}

export {initLegendExample}
